from celery import shared_task
from .models import User

@shared_task
def deduct_membertime_hourly():
    users = User.objects.filter(membertime__gt=0)
    for user in users:
        user.membertime -= 1
        user.save()
    print("Task completed for users:", users)
    return "Task completed"  # 返回一个明确的值来检查